#!/usr/bin/python3

def countLetter(line):
    searchLetter = line[0]
    words = line[2:]
    words = str.lower(words)
    count = 0
    for ch in words:
        if(ch == searchLetter):
            count += 1
    print(count)

print('Please enter a single lower case letter, a blank and a sequence of characters,')
line = input('# to end:\n')
while line != '#':
    countLetter(line)
    print('Please enter a single lower case letter, a blank and a sequence of characters,')
    line = input('# to end:\n')